<template>
  <el-dialog title="设备详情" :visible="showDetailDialog" @close="btnCancel">
    <el-row class="bodyDetail" type="flex" justify="space-around" align="middle">
      <el-col>销售量：<span>{{ saleList.saleCount }}个</span></el-col>
      <el-col>销售额：<span>{{ saleList.salePrice }}.00元</span></el-col>
      <el-col>补货次数：<span>{{ saleList.replenishment }}次</span></el-col>
      <el-col>维修次数：<span>{{ saleList.repairCount }}次</span></el-col>
    </el-row>
    <div class="sku-title">商品销量（月）</div>

    <div v-if="saleList.skuCollect.length === 0" class="none">当前设备未销售商品</div>
    <el-row v-else class="sku-list">
      <el-col v-for="(item,index) in saleList.skuCollect" :key="index" :span="6">
        <el-row class="sku-item">
          <el-col :span="14" class="sku-name">{{ item.skuName }}</el-col>
          <el-col :span="10">：{{ item.count }}</el-col>
        </el-row>
      </el-col>
    </el-row>
  </el-dialog>
</template>

<script>
export default {
  props: {
    showDetailDialog: {
      type: Boolean,
      default: false
    },
    saleList: {
      type: Object,
      required: true
    }
  },
  methods: {
    btnCancel() {
      this.$emit('update:showDetailDialog', false)
    }
  }
}
</script>

<style lang="scss">
.bodyDetail{
  text-align: center;
  background: rgba(227,233,245,.39);
  height: 54px;
  span{
    color: #5f84ff;
  }
}
.sku-title{
  margin: 20px 0 12px 6px;
}
.sku-list{
  border-top: 1px solid #d8dde3;
  border-left: 1px solid #d8dde3;
}
.sku-item{
  padding: 0 10px;
  line-height: 40px;
  border-right: 1px solid #d8dde3;
  border-bottom: 1px solid #d8dde3;
}
.sku-name{
  overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.none{
  text-align: center;
}
</style>

